﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
     <title>Group Campus Visit</title>
     <script type ="text/javascript">

         function isNumeric(keyCode) {

             return ((keyCode >= 48 && keyCode <= 57 || keyCode == 8 ||

            (keyCode >= 96 && keyCode <= 105)));


         }
         function parea() {
             if (document.getElementById('<%= txtArea.ClientID %>').value.length >= 3) {
                 document.getElementById('<%= txtPrefix.ClientID %>').focus();
                 document.getElementById('<%= txtArea.ClientID %>').value.replace(/(^\s+)|\s+$/g, '');

                 return (false);
             }
             return (true);
         }
         function pprefix() {
             if (document.getElementById('<%= txtPrefix.ClientID %>').value.length >= 3) {
                 document.getElementById('<%= txtSuffix.ClientID %>').focus();
                 document.getElementById('<%= txtPrefix.ClientID %>').value.replace(/(^\s+)|\s+$/g, '');

                 return (false);
             }
             return (true);
         }

         function psuffix() {
             if (document.getElementById('<%= txtSuffix.ClientID %>').value.length >= 4) {
                 document.getElementById('<%= txtOrg.ClientID %>').focus();
                 document.getElementById('<%= txtSuffix.ClientID %>').value.replace(/(^\s+)|\s+$/g, '');

                 return (false);
             }


             return (true);
         }
        

        

</script>
    <!-- https connection working for calendar when add all these script like below not http for href="" type exactly like below -->
    <link rel="stylesheet" type="text/css" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/base/jquery-ui.css" />
    <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> 
    <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>



    <script type="text/javascript">

        var date = new Date();
        var date2 = new Date();
        date2.setDate(date2.getDate() + 1);
        var m = date.getMonth();
        var d = date.getDate(), y = date.getFullYear();
        minDate = 1;
        var disabledDays = ["4-3-2015", "5-25-2015", "5-29-2015", "6-19-2015"];
        $(document).ready(function () {
            var txtDatePickers = $('input[type=text][id*=txtdt]'); //No need change any thing here txtdt is datePicker //Finds all input fields with an ID that starts with txtdt


            /******************************************************************/
            /*               Disable a only weekends                        */
            /******************************************************************/


            function noWeekends(date) {
                var noWeekend = $.datepicker.noWeekends(date); return noWeekend;
            }
            $(txtDatePickers).datepicker({ beforeShowDay: noWeekends })

            $(txtDatePickers).datepicker({

                inline: true,
                hideInput: false,
                //Added for month & year
                changeMonth: true,
                changeYear: true,
                //minDate: new Date(2012, 3, 21), // 0-Jan, 1-Feb,2-Mar, 3-Apr,4-May
                //minDate: FindDateTime,
                minDate: 0,
               
                dateFormat: 'mm-dd-yy',
                numberOfMonths: 1, // Show 2 months
                beforeShowDay: noWeekends, // Call function noweekends(date)
                beforeShow: function (input, inst) {
                    $.datepicker._pos = $.datepicker._findPos(input); //this is the default position        
                    $.datepicker._pos[0] = 430; //left         
                    $.datepicker._pos[1] = 115; //top     
                },
                onSelect: function () {

                } // this used to remove after select

            });




            /******************************************************************/
            /*  Disable a Weekends & list of dates (given Holidays)           */
            /******************************************************************/
            var txtHoliday = $('input[type=text][id*=txtday]');  //Finds all input fields with an ID that starts with txtdt

            function disableAllTheseDays(date) {
                var m = date.getMonth(), d = date.getDate(), y = date.getFullYear();
                var day = date.getDay() + 1; //get day
                for (i = 0; i < disabledDays.length; i++) {
                    if ($.inArray((m + 1) + '-' + d + '-' + y, disabledDays) != -1 || new Date() > date || new Date().getDay() + 1 > date)
                    { return [false]; }


                }
                //                //disable other than Monday ,Wednesday and Friday var day = date.getDay(); get day and here  0=sunday 1=monday 2= tuesday 3= wednesday 4= thursday 5= friday 
                //                if ( day != 1 && day != 3 && day != 5 )
                //                { return [false]; }



                return [true];

            }



            // Diable both weekends and list of dates
            function noWeekEndsandHolidays(date) {
                var noWeekend = $.datepicker.noWeekends(date);
                return noWeekend[0] ? disableAllTheseDays(date) : noWeekend;

            }

            /******************************************************************/
            /* Added for 24hr current time                                     */
            /******************************************************************/
            /*==========  check time  ==========*/

            // if time before 12pm, offer next day delivery

            function FindDateTime() {

                var startTime = '12:00 AM';
                var endTime = '12:00 PM';

                var curr_time = getval();

                alert(curr_time.toString());
                //                if (get24Hr(curr_time) > get24Hr(startTime) && get24Hr(curr_time) < get24Hr(endTime)) {

                //                    // before 12pm - next day delivery available
                //                    var nextDayDelivery = '+1d';
                //                    alert(curr_time);

                //                } else {
                //                    // after 12pm - next day delivery unavailable
                //                    var nextDayDelivery = '+2d';
                //                    alert(curr_time);
                //                }
            }


            function get24Hr(time) {
                var hours = Number(time.match(/^(\d+)/)[1]);
                var AMPM = time.match(/\s(.*)$/)[1];
                if (AMPM == "PM" && hours < 12) hours = hours + 12;
                if (AMPM == "AM" && hours == 12) hours = hours - 12;

                var minutes = Number(time.match(/:(\d+)/)[1]);
                hours = hours * 100 + minutes;
                console.log(time + " - " + hours);
                return hours;
            }
            function getval() {
                var currentTime = new Date()
                var hours = currentTime.getHours()
                var minutes = currentTime.getMinutes()

                if (minutes < 10) minutes = "0" + minutes;

                var suffix = "AM";
                if (hours >= 12) {
                    suffix = "PM";
                    hours = hours - 12;
                }
                if (hours == 0) {
                    hours = 12;
                }
                var current_time = hours + ":" + minutes + " " + suffix;

                return current_time;

            }


            /*==========  Make sundays always unavailable  ==========*/


            function available_delivery_dates(date) {

                var sunday = 0; // unavailable for delivery
                var mon = 1
                var tue = 2;
                var wed = 3;
                var thu = 4;
                var fri = 5;
                var sat = 6;

                var day_of_week = date.getDay();

                var not_fri = day_of_week = 5
                //var not_sun = day_of_week > 0;

                if (not_fri) {
                    var day = date.getDate();
                    return [true, ''];
                }
                else {
                    // all else - do not allow
                    return [false, ' ', 'Delivery is unavailable on this day'];
                }



            }

            /******************************************************************/
            /*  End Added for 24hr current time                                     */
            /******************************************************************/

            $(txtHoliday).datepicker({ beforeShowDay: noWeekEndsandHolidays })

            $(txtHoliday).datepicker({

                inline: true,
                hideInput: false,
                //Added for month & year
                changeMonth: true,
                changeYear: true,
                //startDate: '+2d',
                //minDate: new Date(2012, 3, 21), // 0-Jan, 1-Feb,2-Mar, 3-Apr,4-May
                // minDate: FindDateTime,
                // minDate:  minDate.setDate(minDate.getDate() + 2),

                dateFormat: 'mm-dd-yy',
                minDate: 0,
                
                numberOfMonths: 1, // Show 2 months
                beforeShowDay: noWeekends, // Call function noweekends(date)
                beforeShow: function (input, inst) {
                    $.datepicker._pos = $.datepicker._findPos(input); //this is the default position        
                    //                    $.datepicker._pos[0] = 430; //left         
                    //                    $.datepicker._pos[1] = 115; //top     

                },
                onSelect: function () { minDate:0;  } // this used to remove after select



            });



        });
</script>
<style type="text/css">
.ui-datepicker {
   background: #323;
   border: 1px solid #555;
   color: #EFE;
   z-index:200;
   font-size:x-small;

 }
</style>
</head>
<body>
    <form id="form1" style="font-family:Arial, Helvetica, sans-serif;font-size:12px;"   runat="server">
    <div style="width:619px;" >
    
    <p> <span style="color:Red;">* Required Fields</span>  <br />Interested in Avila? A visit to our campus will help you in your decision to enroll.<br />
Please fill out the information and click submit to complete your request for a campus visit. We look forward to meeting you.</p>
</div>
    <table style="width:612px;" >
    <tr valign="top" align="left" ><th align="left" >Name</th>
    <td align="left">
        <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
        <asp:RequiredFieldValidator ForeColor="Red" ID="RequiredFieldValidator3" runat="server"  Display="Static"   
                 ControlToValidate="txtName" InitialValue="" ErrorMessage="*"></asp:RequiredFieldValidator></td>
     <th align="left">Email</th>
     <td align="left" >  <asp:TextBox ID="txtEmail" runat="server"   Font-Size="12px"></asp:TextBox>
                <asp:RequiredFieldValidator ForeColor="Red" ID="rfvEmail" runat="server"  Display="Dynamic"   ControlToValidate="txtEmail"
                    InitialValue="" ErrorMessage="*"  ></asp:RequiredFieldValidator>
                
                <asp:RegularExpressionValidator ForeColor="Red" ID="revEmail" runat="server"  ControlToValidate="txtEmail"
                    Display="Dynamic" ErrorMessage="<br />Provide a valid email"  Font-Size="X-Small"
                    ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator> 
     </td></tr>
      <tr align="left" ><th align="left" >Address</th>
      <td align="left" ><asp:TextBox ID="txtAdd" runat="server"></asp:TextBox>
       <asp:RequiredFieldValidator ForeColor="Red" ID="rfvtxtAdd" runat="server"  Display="Static"  
                 ControlToValidate="txtAdd" 
               InitialValue="" ErrorMessage="*">
               </asp:RequiredFieldValidator></td>
       <th align="left" >City</th>
       <td align="left" >    <asp:TextBox ID="txtCity" runat="server"   Font-Size="12px"></asp:TextBox> 
                <asp:RequiredFieldValidator ForeColor="Red" ID="rfvCity" runat="server"  
                 Display="Static"   ControlToValidate="txtCity" 
                 InitialValue="" ErrorMessage="*"></asp:RequiredFieldValidator> </td></tr>
      
        <tr align="left" valign="top" > <th align="left" >State</th> <td align="left" >     <asp:DropDownList ID="ddState" runat="server"  Font-Size="12px"  Width="130px"
                      onselectedindexchanged=  "ddState_SelectedIndexChanged"  > 
                <asp:ListItem Value=""  Selected="True" >Choose a State</asp:ListItem>
                <asp:ListItem Value="AL">Alabama</asp:ListItem>
                <asp:ListItem Value="AK">Alaska </asp:ListItem>
                <asp:ListItem Value="AZ">Arizona</asp:ListItem>
                <asp:ListItem Value="AR">Arkansas</asp:ListItem>
                <asp:ListItem Value="CA">California</asp:ListItem>
                <asp:ListItem Value="CO">Colorado</asp:ListItem>
                <asp:ListItem Value="CT">Connecticut</asp:ListItem>
                <asp:ListItem Value="DC">D.C.</asp:ListItem>
                <asp:ListItem Value="DE">Delaware</asp:ListItem>
                <asp:ListItem Value="FL">Florida</asp:ListItem>
                <asp:ListItem Value="GA">Georgia</asp:ListItem>
                <asp:ListItem Value="HI">Hawaii</asp:ListItem>
                <asp:ListItem Value="ID">Idaho</asp:ListItem>
                <asp:ListItem Value="IL">Illinois</asp:ListItem>
                <asp:ListItem Value="IN">Indiana</asp:ListItem>
                <asp:ListItem Value="IA">Iowa</asp:ListItem>
                <asp:ListItem Value="KS">Kansas</asp:ListItem>
                <asp:ListItem Value="KY">Kentucky</asp:ListItem>
                <asp:ListItem Value="LA">Louisiana</asp:ListItem>
                <asp:ListItem Value="ME">Maine</asp:ListItem>
                <asp:ListItem Value="MD">Maryland</asp:ListItem>
                <asp:ListItem Value="MA">Massachusetts</asp:ListItem>
                <asp:ListItem Value="MI">Michigan</asp:ListItem>
                <asp:ListItem Value="MN">Minnesota</asp:ListItem>
                <asp:ListItem Value="MS">Mississippi</asp:ListItem>
                <asp:ListItem Value="MO">Missouri</asp:ListItem>
                <asp:ListItem Value="MT">Montana</asp:ListItem>
                <asp:ListItem Value="NE">Nebraska</asp:ListItem>
                <asp:ListItem Value="NV">Nevada</asp:ListItem>
                <asp:ListItem Value="NH">New Hampshire</asp:ListItem>
                <asp:ListItem Value="NJ">New Jersey</asp:ListItem>
                <asp:ListItem Value="NM">New Mexico</asp:ListItem>
                <asp:ListItem Value="NY">New York</asp:ListItem>
                <asp:ListItem Value="NC">North Carolina</asp:ListItem>
                <asp:ListItem Value="ND">North Dakota</asp:ListItem>
                <asp:ListItem Value="OH">Ohio</asp:ListItem>
                <asp:ListItem Value="OK">Oklahoma</asp:ListItem>
                <asp:ListItem Value="OR">Oregon</asp:ListItem>
                <asp:ListItem Value="PA">Pennsylvania</asp:ListItem>
                <asp:ListItem Value="RI">Rhode Island</asp:ListItem>
                <asp:ListItem Value="SC">South Carolina</asp:ListItem>
                <asp:ListItem Value="SD">South Dakota</asp:ListItem>
                <asp:ListItem Value="TN">Tennessee</asp:ListItem>
                <asp:ListItem Value="TX">Texas</asp:ListItem>
                <asp:ListItem Value="UT">Utah</asp:ListItem>
                <asp:ListItem Value="VT">Vermont</asp:ListItem>
                <asp:ListItem Value="VA">Virginia</asp:ListItem>
                <asp:ListItem Value="WA">Washington</asp:ListItem>
                <asp:ListItem Value="WV">West Virginia</asp:ListItem>
                <asp:ListItem Value="WI">Wisconsin</asp:ListItem>
                <asp:ListItem Value="WY">Wyoming</asp:ListItem>
   
            </asp:DropDownList>  
                <asp:RequiredFieldValidator ForeColor="Red" ID="rfvState" runat="server"  Display="Static"  
                 ControlToValidate="ddState" InitialValue="" ErrorMessage="*"></asp:RequiredFieldValidator>   </td> <th align="left" >Zip</th> 
                 <td align="left" > <asp:TextBox ID="txtZip" runat="server"  MaxLength="5"  Font-Size="12px"></asp:TextBox>
               
                <asp:RequiredFieldValidator ForeColor="Red" ID="rfvZip" runat="server"  Display="Dynamic"  ControlToValidate="txtZip"
               InitialValue=""  ErrorMessage="*"></asp:RequiredFieldValidator>
               
                 <asp:RegularExpressionValidator ForeColor="Red" Display="Dynamic" ID="revZip" runat="server"  Font-Size="X-Small"
                     ErrorMessage="<br />Provid a valid 5 Digit Zip Code" ControlToValidate="txtZip" CssClass="errMsg"   ValidationExpression="^([0-9]{5,5})$" 
                  ></asp:RegularExpressionValidator> 
                 
                 
                 </td></tr>
       
           <tr align="left" valign="top" > <th align="left" >Phone</th> <td align="left" >   <asp:TextBox  ID="txtArea" runat="server" MaxLength="3" Width="35px"  Font-Size="12px"
                            ></asp:TextBox>
                <asp:RequiredFieldValidator ForeColor="Red" ID="RFVtxtArea" ControlToValidate="txtArea" Display="Dynamic" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator>  
                        <asp:TextBox ID="txtPrefix" runat="server" MaxLength="3" Width="35px"  Font-Size="12px"
                            ></asp:TextBox> 
                             <asp:RequiredFieldValidator ForeColor="Red" ID="RFVtxtPrefix" Display="Dynamic" ControlToValidate="txtPrefix" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator>  
                        <asp:TextBox ID="txtSuffix" runat="server" MaxLength="4" Width="40px"  Font-Size="12px"
                            ></asp:TextBox> 
           <asp:RequiredFieldValidator ForeColor="Red" ID="RFvtxtSuffix" Display="Dynamic" ControlToValidate="txtSuffix" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator>  

                          <asp:RegularExpressionValidator ForeColor="Red"
                            ID="RExpPhone" runat="server" 
                            Display ="Dynamic" 
                            ErrorMessage="<br />Provide a valid area code" 
                             ControlToValidate="txtArea"
                            ValidationExpression="^([0-9]{3,3})$" 
                            Font-Size="X-Small"></asp:RegularExpressionValidator>
                            <asp:RegularExpressionValidator ForeColor="Red"
                            ID="RegularExpressionValidator2" runat="server" 
                            Display ="Dynamic" 
                            ErrorMessage="<br />Provide a valid middle 3 digits!" 
                             ControlToValidate="txtPrefix"
                            ValidationExpression="^([0-9]{3,3})$" 
                            Font-Size="X-Small"></asp:RegularExpressionValidator>
                            <asp:RegularExpressionValidator ForeColor="Red"
                            ID="RegularExpressionValidator3" runat="server" 
                            Display ="Dynamic" 
                            ErrorMessage="<br />Provide a valid last 4 digits!" 
                            ControlToValidate="txtSuffix"
                            ValidationExpression="^([0-9]{4,4})$" 
                            Font-Size="X-Small"></asp:RegularExpressionValidator>
                 </td> <th align="left" >Organization</th> <td align="left" ><asp:TextBox ID="txtOrg" runat="server"></asp:TextBox></td></tr>
           
            <tr align="left" > <th align="left" >Visit Date</th> 
            <td align="left" ><asp:TextBox ID="txtday"   runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ForeColor="Red" ID="RequiredFieldValidator1" runat="server"  Display="Static"  
                 ControlToValidate="txtday" InitialValue="" ErrorMessage="*"></asp:RequiredFieldValidator>
            
            </td> 
            
            <th align="left" >Visit Time</th> <td align="left" >
                <asp:DropDownList ID="ddVisitTime" runat="server">
                </asp:DropDownList>
                 <asp:RequiredFieldValidator ForeColor="Red" ID="RequiredFieldValidator2" runat="server"  Display="Static"  
                 ControlToValidate="ddVisitTime" InitialValue="" ErrorMessage="*"></asp:RequiredFieldValidator>
                </td></tr>
                       
           </table>
           <br />
         <table style="width:612px;" >
            <tr align="left" ><th align="left" colspan="4">How many students and Adult ( there must be 1 adult per 10 kids)</th></tr>
             <tr align="left" > <th align="left" >No of Students</th> 
             <td align="left" ><asp:TextBox ID="txtStud" runat="server"></asp:TextBox>
                <asp:RegularExpressionValidator ForeColor="Red" Display="Dynamic" ID="RegularExpressionValidator1" runat="server"  Font-Size="X-Small"
                     ErrorMessage="<br />Provid a 2 digit number" ControlToValidate="txtStud" CssClass="errMsg"   ValidationExpression="^([0-9]{1,2})$" 
                  ></asp:RegularExpressionValidator> 
             
             </td> 
            
              <th align="left" >Age Group</th> <td align="left" >
                  <asp:DropDownList ID="ddAgeGrp" runat="server">
                      <asp:ListItem Value="">Select...</asp:ListItem>
                      <asp:ListItem>Freshman and younger</asp:ListItem>
                      <asp:ListItem>Juniors</asp:ListItem>
                      <asp:ListItem>Seniors</asp:ListItem>
                      <asp:ListItem>Sophomore</asp:ListItem>
                  </asp:DropDownList>
                  <asp:RequiredFieldValidator ForeColor="Red" ID="rfvAgeGrp" ControlToValidate="ddAgeGrp" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator>

                </td></tr>
              <tr align="left" > <th align="left" >No of Adults</th> 
              <td align="left" ><asp:TextBox ID="txtAdult" runat="server"></asp:TextBox>
              
               <asp:RegularExpressionValidator ForeColor="Red" Display="Dynamic" ID="RegularExpressionValidator4" runat="server"  Font-Size="X-Small"
                     ErrorMessage="<br />Provid a 2 digit number" ControlToValidate="txtAdult" CssClass="errMsg"   ValidationExpression="^([0-9]{1,2})$" 
                  ></asp:RegularExpressionValidator> 
              </td> </tr>
               </table>
           <br />
          <table style="width:612px;" >
                <tr  valign="top" align="left" ><th  align="left" colspan="3" class="style2" >Will the group be eating lunch in the cafeteria? 
                    <asp:RequiredFieldValidator ForeColor="Red" ID="RequiredFieldValidator4" runat="server"  Display="Dynamic"   ControlToValidate="rbLunch"
                    InitialValue="" ErrorMessage="*"  ></asp:RequiredFieldValidator>
                </th><td  align="left" >
                    <asp:RadioButtonList ID="rbLunch" runat="server" RepeatDirection="Horizontal">
                        <asp:ListItem>Yes</asp:ListItem>
                        <asp:ListItem>No</asp:ListItem>

                    </asp:RadioButtonList>
                 
                </td> </tr>
                <tr align="left"> <th  align="left" colspan="4"> If so the meal is $6.44 per person, and is paid for by your organization, must be a check or cash. </th></tr>
                  <tr align="center"> <th  align="center" colspan="4"> <br /></th></tr>
                 <tr align="center"> <th  align="center" colspan="4"> 
                     <asp:Button ID="btnSubmit" runat="server" 
                Text="Submit" style="font-size:larger; font-weight:bold;" 
                  Height="35px" Width="101px" onclick="btnSubmit_Click" /></th></tr>
    </table>



    </form>
</body>
</html>
